Class Parser

java.lang.Object
es.csic.iiia.fabregues.dip.comm.Parser

public class Parser
extends java.lang.Object
Modifies the game and get info from it
Author:
Angela Fabregues, IIIA-CSIC, fabregues@iiia.csic.es
  • Constructor Summary

    Constructors 
    Constructor Description
    Parser()  
  • Method Summary

    Modifier and Type Method Description
    static GameBuilder createGameBuilder()  
    static GameBuilder createGameBuilder​(java.lang.String[] mdf)  
    static GameBuilder createGameBuilder​(java.lang.String[] mdf, java.lang.String[] homes)  
    static java.lang.String[] formatOrders​(java.util.List<Order> orders)  
    static java.lang.String[] getNOW​(Game game)
    Generate the current NOW message NOW (turn) (unit) (unit) ? This is sent from the server to the AI at the start of the game, and after every turn.
    static java.lang.String[] getSCO​(Game game)  
    static void setHomes​(java.lang.String[] scoMessage, Game game)
    Fica les homes a cada potencia
    static void updateControlledRegions​(java.lang.String[] message, Game game)
    Update controlled regions info
    static void updateOwnedSCs​(java.lang.String[] scoMessage, Game game)
    Update info about ownded SCs

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • setHomes

      public static void setHomes​(java.lang.String[] scoMessage, Game game)
      Fica les homes a cada potencia
      Parameters:
      scoMessage - TODO move to another place
    • updateOwnedSCs

      public static void updateOwnedSCs​(java.lang.String[] scoMessage, Game game)
      Update info about ownded SCs
      Parameters:
      scoMessage - TODO move to another place
    • updateControlledRegions

      public static void updateControlledRegions​(java.lang.String[] message, Game game)
      Update controlled regions info
      Parameters:
      message - TODO move to another place
    • getSCO

      public static java.lang.String[] getSCO​(Game game)
    • getNOW

      public static java.lang.String[] getNOW​(Game game)
      Generate the current NOW message NOW (turn) (unit) (unit) ? This is sent from the server to the AI at the start of the game, and after every turn. It indicates the current turn, and the current unit positions. E.g. at the start of the game: NOW (SPR 1901) (AUS FLT TRI) (AUS AMY BUD) (AUS AMY VIE) (ENG FLT LON) ? Units in bicoastal provinces have a province and coast bracketed together. E.g. : (RUS FLT (STP SCS)) Before a retreat turn, units may have a list of retreat options, prefixed by MRT (Must retreat to). E.g. (ENG FLT NTH MRT (LON YOR EDI NWG)) If you have no possible retreats, then the unit will still be listed, and you still must order the disband. E.g.(ENG FLT NTH MRT ()) Retreat options will include a coast if a fleet can retreat to a multi-coastal province. e.g.(TUR FLT CON MRT (BLA SMY (BUL ECS) (BUL SCS))) The AI can send the command NOW to the server with no arguments at any time. The server will reply by sending another copy of the latest NOW message, or REJ(NOW) if the game hasn?t started.
      Returns:
      TODO move to another place
    • createGameBuilder

      public static GameBuilder createGameBuilder​(java.lang.String[] mdf, java.lang.String[] homes)
    • createGameBuilder

      public static GameBuilder createGameBuilder​(java.lang.String[] mdf)
    • createGameBuilder

      public static GameBuilder createGameBuilder()
    • formatOrders

      public static java.lang.String[] formatOrders​(java.util.List<Order> orders)